package enums;

import org.apache.commons.lang3.StringUtils;

/**
 * @author ke
 * Created by on  2021-05-26 15:53
 */
public enum EventTypeEnum {

    /**
     * 人群
     */
    BUSINESS_ONE("business_one", "业务一"),
    /**
     * 过敏
     */
    BUSINESS_TWO("business_two", "业务二"),
    /**
     * 疾病名称
     */
    BUSINESS_THREE("business_three", "业务三");

    private final String type;

    private final String name;

    public String getName() {
        return this.name;
    }

    public String getType() {
        return this.type;
    }

    EventTypeEnum(String type, String name) {
        this.type = type;
        this.name = name;
    }

    public static EventTypeEnum getByType(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (EventTypeEnum typeEnum : values()) {
            if (type.equals(typeEnum.getType())) {
                return typeEnum;
            }
        }
        return null;
    }
}
